<template>
<div class="nav">
    <div>饿了么</div>
    <div class="check">
        <span v-for="(item,index) in list" :key="index" @click="handlerClick(index)" :class="{active:currentIndex==index}">{{item}}</span>
    </div>
</div>
</template>

<script>
export default {
    data(){
        return {
            list:['全部','待消费','待评价','退款'],
            currentIndex:0
        }
    },
    methods:{
        handlerClick(index){
            this.currentIndex=index
        }
    },
}
</script>

<style scoped>
.nav{
    display: flex;
    flex-direction: column;
}
.nav span{
    display: block;
    margin: 5px 10px;
}
.nav div:nth-child(1){
    height: 30px;
    line-height: 30px;
    text-align: center;
    width: 100%;
    font-size: 16px;
}
.check{
    display: flex;
    justify-content: flex-start;
    margin-top: 20px;
    margin-top: 10px;
}
.check span.active{
    border-bottom: 2px solid blue;
}
</style>